<template>
  <div class="container">
    <div class="header" v-if="$slots.title">
      <slot name="title"></slot>
    </div>
    <div class="box">
      <div class="box-item" v-for="item in list" :key="item.id">
        <div class="left">
          <slot name="left" :msg="item">左侧</slot>
        </div>
        <div class="right">
          <slot name="right" :msg="item">右侧</slot>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
    },
    list: {
      type: Array,
      default: () => [],
    },
  },
}
</script>

<style scoped lang="less">
.container {
  background: white;
  width: 300px;
  margin: 10px;
  border-radius: 5px;

  .box {
    padding: 10px;
    .box-item {
      height: 50px;
      border-bottom: 1px solid rgb(102, 11, 230);
      display: flex;
      align-items: center;

      display: flex;
      justify-content: space-between;

      .right {
        display: flex;
        align-items: center;
      }
    }

    .box-item:last-child {
      border-bottom: none;
    }
  }

  .header {
    border-radius: 5px 5px 0 0;
    color: white;
    display: flex;
    align-items: center;
    height: 50px;
    padding-left: 30px;
    font-weight: bold;
    background: linear-gradient(to right, #04c2d3, #0f68cd);
  }
}
</style>
